-
Notifications
You must be signed in to change notification settings - Fork 17
[flakiness] pytest - use rerunfailures for retries #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
MCK 1.3.0 Release NotesNew FeaturesMulti-Architecture SupportWe've added comprehensive multi-architecture support for the kubernetes operator. This enhancement enables deployment on IBM Power (ppc64le) and IBM Z (s390x) architectures alongside
Bug Fixes
Other Changes
|
@@ -22,6 +22,7 @@ def test_replica_set_sts_exists(self): | |||
sts = self.appsv1.read_namespaced_stateful_set("rs001-pv", self.namespace) | |||
assert sts | |||
|
|||
@pytest.mark.flaky(reruns=3, reruns_delay=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statefulset might be ready and then quickly not. Its an intermittent error and we should retry here
[2025/08/29 20:27:31.171] FAILURE: assert 2 == 3
[2025/08/29 20:27:31.171] + where 2 = {'available_replicas': 2,\n 'collision_count': 0,\n 'conditions': None,\n 'current_replicas': 3,\n 'current_revision': 'rs001-pv-56c4dc5d86',\n 'observed_generation': 1,\n 'ready_replicas': 2,\n 'replicas': 3,\n 'update_revision': 'rs001-pv-56c4dc5d86',\n 'updated_replicas': 3}.ready_replicas
[2025/08/29 20:27:31.17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker/mongodb-kubernetes-tests/tests/multicluster/multi_cluster_backup_restore.py
Outdated
Show resolved
Hide resolved
…ubernetes into add-retries-pytest-dec
docker/mongodb-kubernetes-tests/tests/multicluster/multi_cluster_backup_restore.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary
This pull request improves the reliability of several end-to-end and integration tests in the MongoDB Kubernetes test suite by replacing custom retry logic with standardized pytest flakiness handling. The changes primarily remove manual retry loops from test cases and instead use the
pytest.mark.flaky
decorator to automatically rerun flaky tests, making the code cleaner and more maintainable.Test stability improvements:
pytest.mark.flaky
decorators to multiple test cases to automatically rerun tests on failure, replacing custom retry logic.e2e_replica_set
ande2e_replica_set_pv
which is racy/flakyDependency and import adjustments:
pytest
imports to test files to support the use of theflaky
marker.Proof of Work
Checklist
skip-changelog
label if not needed